package com.dxq.oa.ontroller;

import com.dxq.oa.entity.Menu;
import com.dxq.oa.pub.OaResult;
import com.dxq.oa.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class MenuController {

    @Autowired
    private MenuService menuService;
    @PostMapping("/addMenu")
    public OaResult addMenu(@RequestBody Menu menu){

        log.info("添加菜单"+menu.toString());

        if(this.menuService.addmenu(menu)){
            return OaResult.getSuccess("添加成功");
        }
        return OaResult.error("添加失败");
    }
}
